package entrepot;

public class Emplacement {
	
	int position;
	boolean isEntry;
	boolean isExit;
	
	public Emplacement(int position, boolean isEntry, boolean isExit) {
		super();
		this.position = position;
		this.isEntry = isEntry;
		this.isExit = isExit;
	}
	
	public int getPosition() {
		return position;
	}
	public void setPosition(int position) {
		this.position = position;
	}
	public boolean isEntry() {
		return isEntry;
	}
	public void setEntry(boolean isEntry) {
		this.isEntry = isEntry;
	}
	public boolean isExit() {
		return isExit;
	}
	public void setExit(boolean isExit) {
		this.isExit = isExit;
	}

	@Override
	public String toString() {
		return "Emplacement [position=" + position + ", isEntry=" + isEntry
				+ ", isExit=" + isExit + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (isEntry ? 1231 : 1237);
		result = prime * result + (isExit ? 1231 : 1237);
		result = prime * result + position;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Emplacement other = (Emplacement) obj;
		if (isEntry != other.isEntry)
			return false;
		if (isExit != other.isExit)
			return false;
		if (position != other.position)
			return false;
		return true;
	}
	
	public boolean isInFirstAisle(Produit p){
		return (p.getPosition() >= 13) ? true : false;
	}
	
	public boolean isInSecondAisle(Produit p){
		return (p.getPosition() < 13) ? true : false;
	}
}
